package com.ztesoft.huangfu.learning.springboot.es.page;

import java.util.List;

/**
 * Created with IntelliJ IDEA.
 * Author: huangfu.daohui
 * Date: 2018/12/20
 * Time: 14:04
 * Version: 1.0
 * Description: 分页
 * 可用ES自带的分页：Pageable page = new PageRequest(pageNo, pageSize);
 **/
public class Page<T> extends SimplePage implements java.io.Serializable,
        Paginable {

    public Page() {
    }

    public Page(int pageNo, int pageSize, int totalCount) {
        super(pageNo, pageSize, totalCount);
    }

    @SuppressWarnings({"unchecked", "rawtypes"})
    public Page(int pageNo, int pageSize, int totalCount, List list) {
        super(pageNo, pageSize, totalCount);
        this.list = list;
    }

    public int getFirstResult() {
        return (pageNo - 1) * pageSize;
    }

    /**
     * 当前页的数据
     */
    private List<T> list;

    public List<T> getList() {
        return list;
    }

    public void setList(List<T> list) {
        this.list = list;
    }
}